package com.jyb.controller;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.jfinal.core.Controller;
import com.jyb.enumeration.ShanghaiDistrict;
import com.jyb.util.CqjhMtUtil;
import com.jyb.util.StringUtils;
import com.jyb.util.capture.CqjhUtil;
import com.jyb.vo.CqjhVo;

public class CqjhController extends Controller{

	public void index(){
		
		String mt=getPara("mt");
		String value=getPara("value");
		
		List<CqjhVo> vos=new ArrayList<CqjhVo>();
		if(!StringUtils.isEmpty(value)&&!StringUtils.isEmpty(mt)){
			
			value=value.trim();
			
			ShanghaiDistrict district=ShanghaiDistrict.of(mt);
			vos=CqjhUtil.capture(district, value);
			
			setAttr("vos", vos);
			setAttr("mt", district);
			setAttr("value", value);
		}else{
			setAttr("mt", ShanghaiDistrict.WY);
		}
		
		setAttr("mtVos", CqjhMtUtil.getMts());
		setAttr("mtShips", JSON.toJSON(CqjhMtUtil.getMts()));
		
		setAttr("nav", "cqjh");
		renderJsp("/views/cqjh/index.jsp");
	}
}
